import { Injectable } from '@nestjs/common';
import { Counter } from 'prom-client';

@Injectable()
export class MetricsService {
  private requestCounter: Counter;

  constructor() {
    this.requestCounter = new Counter({
      name: 'http_request_total',
      help: '统计http请求数量',
      labelNames: ['method', 'path'],
    });
  }

  incrementRequestCount(method: string, path: string) {
    this.requestCounter.labels(method, path).inc();
  }
}
